package Exceptions;

/**
 * Exception for load save operations
 * @author itay, based on Assaf code
 */
@SuppressWarnings("serial")
public class SaveLoadException extends StrategoException {

    public SaveLoadExceptionType type;

    public SaveLoadException(SaveLoadExceptionType type) {
        super(type.getDescription());
        this.type = type;
    }

    /**
     * @return the type
     */
    public SaveLoadExceptionType getType() {
        return type;
    }

    /**
     * @param type the type to set
     */
    public void setType(SaveLoadExceptionType type) {
        this.type = type;
    }

    public enum SaveLoadExceptionType {
    	SaveBadPath("Cannot save file - bad path"),
        SaveBadFilename("Cannot save file - bad filename"),
        LoadBadFilename("Cannot load file - bad filename"),
        LoadCorrupted("Cannot load file - corrupted file"),
        LoadBadPath("Cannot load file - bad path");
    	
        private String desc;
        SaveLoadExceptionType(String desc) {
            this.desc = desc;
        }
        public String getDescription() {
            return desc;
        }
    }
}
